package Handling;
import java.sql.*;

public class DB_Connection {
	
	
	private String Driver = "org.h2.Driver";

	public DB_Connection(){
		loadDriver();
	}

	/**
	 * loads the driver is called in the DbVerbindung constructor
	 */
	public void loadDriver() {
		try {

			Class.forName(this.Driver);


		} catch (Exception e) {
			System.out.println("** Error loading Driver **");
			e.printStackTrace();
		}
	}

	/**
	 * connects to the database located at the url
	 * @return connection to the database
	 * @throws SQLException
	 */
	public Connection connect_DB() throws SQLException {
		String url = "jdbc:h2:~/workspace/StuttgartMonopoly/Monopoly";
		String user = "root";
		String password = "stuttgart";
		return DriverManager.getConnection(url, user, password);
	}
}
